package com.yuanduan.mplus.view;

import android.app.ProgressDialog;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ImageButton;
import android.widget.Spinner;
import android.widget.TextView;

import com.cj.framework.app.BaseActivity;
import com.cj.framework.util.HttpImp;
import com.cj.framework.util.IHttp;
import com.cj.framework.util.RSAUtils;
import com.github.mikephil.charting.animation.Easing;
import com.github.mikephil.charting.charts.BarChart;
import com.github.mikephil.charting.charts.LineChart;
import com.github.mikephil.charting.components.Legend;
import com.github.mikephil.charting.components.LimitLine;
import com.github.mikephil.charting.components.XAxis;
import com.github.mikephil.charting.components.YAxis;
import com.github.mikephil.charting.data.BarData;
import com.github.mikephil.charting.data.BarDataSet;
import com.github.mikephil.charting.data.BarEntry;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.LineData;
import com.github.mikephil.charting.data.LineDataSet;
import com.github.mikephil.charting.interfaces.datasets.IBarDataSet;
import com.github.mikephil.charting.interfaces.datasets.ILineDataSet;
import com.yuanduan.mplus.R;
import com.yuanduan.mplus.config.Config;
import com.yuanduan.mplus.model.DBManager;
import com.yuanduan.mplus.model.entity.User;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;

/**
 * Created by cj on 2016/6/6.
 * Email:781806481@qq.com
 * 废弃，驾驶评分
 */
public class DriveScoreActivity extends BaseActivity implements View.OnClickListener, AdapterView.OnItemSelectedListener {
    private ImageButton ib_back;
    private Spinner spinner;

    //年，周信息
    private ArrayList<DateInfo> dateInfos=new ArrayList<>();

    //柱状图信息
    private TextView tv_safetyMessage;
    private TextView tv_safetyPaiming;
    private TextView tv_economicalMessage;
    private TextView tv_economicalPaiming;
    private BarChart barChart;
    //安全驾驶评分详情，经济驾驶评分详情
    private TextView tv_safetyDetail;
    private TextView tv_economicalDetail;
    //对该司机进行点评
    private TextView tv_comment;
    //人名
    private TextView tv_driver;
    //点评暂时不写
//    private TextView tv_commentsTitle;

    //安全驾驶表
    private TextView tv_safetyTitle;
    private LineChart safetyLinechart;
    //经济驾驶表
    private TextView tv_economicalTitle;
    private LineChart economicalLineChart;


    private User user;


    //柱状图数据
    private ArrayList<ArrayList<Float>> scoreDatas =new ArrayList<ArrayList<Float>>();
    private ArrayList<String> legend1=new ArrayList<>();
    private ArrayList<String> xValues1=new ArrayList<>();
    //安全线性图数据
    private ArrayList<ArrayList<Float>> safetyDatas=new ArrayList<ArrayList<Float>>();
    private ArrayList<String> legend2=new ArrayList<>();
    private ArrayList<String> xValues2=new ArrayList<>();
    //经济线型图数据
    private ArrayList<ArrayList<Float>>  economicalDatas=new ArrayList<ArrayList<Float>>();
    private ArrayList<String> legend3=new ArrayList<>();
    private ArrayList<String> xValues3=new ArrayList<>();

    private int currentLevel=0;
    private ProgressDialog progressDialog;
    private IHttp iHttp=new HttpImp();
    private Calendar calendar=Calendar.getInstance();
    private IHttp.HttpInfoCallbackWithIndex callback=new IHttp.HttpInfoCallbackWithIndex() {
        @Override
        public void onSucceed(Object result, int index) {
            new Handler().postDelayed(new Runnable() {
                @Override
                public void run() {
                    progressDialog.dismiss();
                }
            },1000);
            if(result==null){
                return;
            }
            String result1= RSAUtils.decryptWithRSA((String) result);
            Log.d("oo",result1);
            JSONObject datas=null;
            try {
                datas=new JSONObject(result1);
                if(datas==null){
                    return;
                }
                if(datas.getInt("RS")!=1){
                    return;
                }
            } catch (JSONException e) {
                e.printStackTrace();
            }
            fillData(datas);
            //将数据填入图表

            setData(legend1,xValues1,legend2,xValues2,legend3,xValues3);
            switch(index){
                case 0:
                    currentLevel=0;
                    break;
                case 1:
                    currentLevel=1;
                    break;
                case 2:
                    currentLevel=2;
                    break;
                case 3:
                    currentLevel=3;
                    break;
            }
            tv_economicalTitle.setText(dateInfos.get(currentLevel).weekcode+"周经济趋势分析");
            tv_safetyTitle.setText(dateInfos.get(currentLevel).weekcode+"周经济趋势分析");
        }

        @Override
        public void onFailed(Object result, int index) {

        }
    };

    private void setData(ArrayList<String> legends1,ArrayList<String> xValus1,ArrayList<String> legends2,ArrayList<String> xValus2,ArrayList<String> legends3,ArrayList<String> xValus3) {
        //柱状图
        ArrayList<IBarDataSet> barDataSets=new ArrayList<>();
        for(int i=0;i<scoreDatas.size();i++){
            ArrayList<BarEntry> barEntries=new ArrayList<>();
            for(int j=0;j<scoreDatas.get(i).size();j++){
                BarEntry entry=new BarEntry(scoreDatas.get(i).get(j),j);
                barEntries.add(entry);
            }
            BarDataSet barDataSet=new BarDataSet(barEntries,legends1.get(i));
            barDataSets.add(barDataSet);
        }
        ((BarDataSet)barDataSets.get(0)).setColor(Color.RED);
        ((BarDataSet)barDataSets.get(1)).setColor(Color.BLUE);
        ((BarDataSet)barDataSets.get(2)).setColor(Color.GREEN);
        BarData barData=new BarData(xValus1,barDataSets);
        barChart.setDescription("");
        barChart.getXAxis().setPosition(XAxis.XAxisPosition.TOP);
        barChart.getAxisLeft().setAxisMinValue(0);
        barChart.getAxisRight().setAxisMinValue(0);
        barChart.setData(barData);
        barChart.animateY(3000,Easing.EasingOption.EaseInCubic);

        //安全驾驶线性图
        ArrayList<ILineDataSet> lineDataSets=new ArrayList<>();
        for(int i=0;i<safetyDatas.size();i++){
            ArrayList<Entry> entries=new ArrayList<>();
            for(int j=0;j<safetyDatas.get(i).size();j++){
                Entry entry=new Entry(safetyDatas.get(i).get(j),j);
                entries.add(entry);
            }
            LineDataSet lineDataSet=new LineDataSet(entries,legends2.get(i));
            lineDataSets.add(lineDataSet);
        }
        ((LineDataSet)lineDataSets.get(0)).setColor(Color.RED);
        ((LineDataSet)lineDataSets.get(1)).setColor(Color.BLUE);
        ((LineDataSet)lineDataSets.get(2)).setColor(Color.GREEN);
        LineData lineData=new LineData(xValus2,lineDataSets);
        safetyLinechart.setData(lineData);
        safetyLinechart.setDescription("");
        safetyLinechart.getAxisLeft().setAxisMinValue(0);
        safetyLinechart.getAxisRight().setAxisMinValue(0);
        safetyLinechart.getXAxis().setPosition(XAxis.XAxisPosition.BOTTOM);
        safetyLinechart.animateY(2000,Easing.EasingOption.EaseInCubic);

        //经济驾驶线型图
        ArrayList<ILineDataSet> lineDataSets1=new ArrayList<>();
        for(int i=0;i<economicalDatas.size();i++){
            ArrayList<Entry> entries=new ArrayList<>();
            for(int j=0;j<economicalDatas.get(i).size();j++){
                Entry entry=new Entry(economicalDatas.get(i).get(j),j);
                entries.add(entry);
            }
            LineDataSet lineDataSet=new LineDataSet(entries,legends3.get(i));
            lineDataSets1.add(lineDataSet);
        }

        ((LineDataSet)lineDataSets1.get(0)).setColor(Color.RED);
        ((LineDataSet)lineDataSets1.get(1)).setColor(Color.BLUE);
        ((LineDataSet)lineDataSets1.get(2)).setColor(Color.GREEN);

        LineData lineData1=new LineData(xValus3,lineDataSets1);
        economicalLineChart.setData(lineData1);
        economicalLineChart.setDescription("");
        economicalLineChart.getAxisLeft().setAxisMinValue(0);
        economicalLineChart.getAxisRight().setAxisMinValue(0);
        economicalLineChart.getXAxis().setPosition(XAxis.XAxisPosition.BOTTOM);
        economicalLineChart.animateY(3000,Easing.EasingOption.EaseInCubic);
    }

    private void fillData(JSONObject datas) {
        scoreDatas.clear();
        safetyDatas.clear();
        economicalDatas.clear();
        //将数据填入集合中
//        JSONObject economicalrank;
        ArrayList<Float> maxranklist=new ArrayList<>();
        ArrayList<Float> avgranklist=new ArrayList<>();
        ArrayList<Float> selfranklist=new ArrayList<>();

        ArrayList<Float> maxsecuritylists=new ArrayList<>();
        ArrayList<Float> selfsecuritylists=new ArrayList<>();
        ArrayList<Float> minsecuritylists=new ArrayList<>();

        ArrayList<Float> maxeconomiclists=new ArrayList<>();
        ArrayList<Float> selfeconomiclists=new ArrayList<>();
        ArrayList<Float> mineconomiclists=new ArrayList<>();

        try {
            JSONObject securityrank=datas.getJSONObject("SecurityRank");
            JSONObject economicalrank=datas.getJSONObject("EconomicRank");
            JSONArray securitylist=datas.getJSONArray("SecurityDataList");
            JSONArray economicallist=datas.getJSONArray("EconomicDataList");
            if(securityrank==null||economicalrank==null||securitylist==null){
                return;
            }
            //柱状图数据
            maxranklist.add((float) securityrank.getInt("maxScore"));
            maxranklist.add((float) economicalrank.getInt("maxScore"));
            avgranklist.add((float) securityrank.getInt("averageScore"));
            avgranklist.add((float) economicalrank.getInt("averageScore"));
            selfranklist.add((float) securityrank.getInt("selfScore"));
            selfranklist.add((float) economicalrank.getInt("selfScore"));
            //排行数据
            tv_economicalPaiming.setText(economicalrank.getInt("selfRank")+"/"+economicalrank.getInt("maxRank"));
            tv_safetyPaiming.setText(securityrank.getInt("selfRank")+"/"+securityrank.getInt("maxRank"));

            //安全数据
            for(int i=0;i<securitylist.length();i++){
                JSONObject securityObject=securitylist.getJSONObject(i);
                maxsecuritylists.add((float) securityObject.getInt("max"));
                selfsecuritylists.add((float) securityObject.getInt("self"));
                minsecuritylists.add((float) securityObject.getInt("minimum"));
            }

            //经济数据
            for(int i=0;i<economicallist.length();i++){
                JSONObject economicObject=economicallist.getJSONObject(i);
                maxeconomiclists.add((float) economicObject.getInt("max"));
                selfeconomiclists.add((float) economicObject.getInt("self"));
                mineconomiclists.add((float) economicObject.getInt("minimum"));
            }

        } catch (JSONException e) {
            e.printStackTrace();
        }
        scoreDatas.add(maxranklist);
        scoreDatas.add(avgranklist);
        scoreDatas.add(selfranklist);

        safetyDatas.add(maxsecuritylists);
        safetyDatas.add(selfsecuritylists);
        safetyDatas.add(minsecuritylists);

        economicalDatas.add(maxeconomiclists);
        economicalDatas.add(selfeconomiclists);
        economicalDatas.add(mineconomiclists);
        int i=0;
    }

    private String realName;
    @Override
    protected void findId() {
        ib_back= (ImageButton) findViewById(R.id.drivescore_ib_back);
        spinner= (Spinner) findViewById(R.id.drivescore_spinner);
        tv_safetyMessage= (TextView) findViewById(R.id.drivescore_tv_safetyMessage);
        tv_safetyPaiming= (TextView) findViewById(R.id.drivescore_tv_safetypaiming);
        tv_economicalMessage= (TextView) findViewById(R.id.drivescore_tv_economicalMessage);
        tv_economicalPaiming= (TextView) findViewById(R.id.drivescore_tv_economicalpaiming);
        barChart= (BarChart) findViewById(R.id.drivescore_barchart);
        tv_safetyDetail= (TextView) findViewById(R.id.drivescore_tv_safetyDetail);
        tv_economicalDetail= (TextView) findViewById(R.id.drivescore_tv_economicalDetail);
        tv_comment= (TextView) findViewById(R.id.drivescore_tv_comment);
        tv_driver= (TextView) findViewById(R.id.drivescore_tv_driver);

        tv_safetyTitle= (TextView) findViewById(R.id.drivescore_tv_safetyTitle);
        safetyLinechart= (LineChart) findViewById(R.id.drivescore_linechart_safety);

        tv_economicalTitle= (TextView) findViewById(R.id.drivescore_tv_economicalTitle);
        economicalLineChart= (LineChart) findViewById(R.id.drivescore_linechart_economical);
    }

    @Override
    protected void logic() {
        user= DBManager.getInstance(getApplicationContext()).getUser();
        getDateInfos();
        ArrayAdapter adapter=new ArrayAdapter(this,android.R.layout.simple_spinner_dropdown_item,new String[]{"("+dateInfos.get(0).weekcode+"周)评分","("+(dateInfos.get(1).weekcode)+"周)评分","("+(dateInfos.get(2).weekcode)+"周)评分","("+(dateInfos.get(3).weekcode)+"周)评分"});
        spinner.setAdapter(adapter);
//        initBarChart();
        progressDialog=new ProgressDialog(this);
        ib_back.setOnClickListener(this);
        spinner.setOnItemSelectedListener(this);
        tv_safetyDetail.setOnClickListener(this);
        tv_economicalDetail.setOnClickListener(this);
        tv_comment.setOnClickListener(this);

        tv_safetyTitle.setText(dateInfos.get(0).weekcode+"周安全趋势分析");
        tv_economicalTitle.setText(dateInfos.get(0).weekcode+"周经济趋势分析");

        legend1.add("最高评分");
        legend1.add("平均评分");
        legend1.add("我的评分");
        xValues1.add("安全");
        xValues1.add("经济");

        legend2.add("MAX安全");
        legend2.add("安全");
        legend2.add("MIN安全");
        xValues2.add(dateInfos.get(3).weekcode+"周");
        xValues2.add(dateInfos.get(2).weekcode+"周");
        xValues2.add(dateInfos.get(1).weekcode+"周");
        xValues2.add(dateInfos.get(0).weekcode+"周");


        legend3.add("MAX安全");
        legend3.add("安全");
        legend3.add("MIN安全");
        xValues3.add(dateInfos.get(3).weekcode+"周");
        xValues3.add(dateInfos.get(2).weekcode+"周");
        xValues3.add(dateInfos.get(1).weekcode+"周");
        xValues3.add(dateInfos.get(0).weekcode+"周");

        if(Config.userType==1){
            //隐藏点评按钮;
            tv_comment.setVisibility(View.GONE);
            //showprogress
            //发送网络请求，请求周数据
            progressDialog.show();
            HashMap<String,String> hashMap=new HashMap<>();
            hashMap.put("UserPhone",user.getUserPhone());
            hashMap.put("YearCode",dateInfos.get(0).yearcode+"");
            hashMap.put("WeekCode",dateInfos.get(0).weekcode+"");
            iHttp.httpInfoPostWithIndex(Config.URL+Config.SCOREREPORT,Config.translateMap(hashMap),callback,0);

        }else if(Config.userType==2){
            //设置标题栏的名字
            Bundle bundle=getIntent().getExtras();
            tv_driver.setVisibility(View.VISIBLE);
            tv_driver.setText(bundle.getString("RealName"));
            tv_comment.setVisibility(View.VISIBLE);
            //showProgress
            //发送网络请求，请求周数据数据
            progressDialog.show();
            HashMap<String,String> hashMap=new HashMap<>();
            hashMap.put("UserPhone",bundle.getString("UserPhone"));
            hashMap.put("YearCode",dateInfos.get(0).yearcode+"");
            hashMap.put("WeekCode",dateInfos.get(0).weekcode+"");
            iHttp.httpInfoPostWithIndex(Config.URL+Config.SCOREREPORT,Config.translateMap(hashMap),callback,0);
//            iHttp.httpInfoPostWithIndex(Config.URL,new HashMap<String, String>(),callback,0);
        }else{

        }

    }

    @Override
    protected int setLayout() {
        return R.layout.activity_drivescore;
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.drivescore_ib_back:
                this.finish();
                break;
            case R.id.drivescore_tv_safetyDetail:
                //打开安全驾驶评分详情
                Bundle bundle=new Bundle();
                bundle.putString("UserPhone",getIntent().getExtras().getString("UserPhone"));
                bundle.putString("RealName",getIntent().getExtras().getString("RealName"));
                openActivity(SafetyDriveDetailActivity.class,bundle);
                break;
            case R.id.drivescore_tv_economicalDetail:
                //打开经济驾驶评分详情
                Bundle bundle1=new Bundle();
                bundle1.putString("UserPhone",getIntent().getExtras().getString("UserPhone"));
                bundle1.putString("RealName",getIntent().getExtras().getString("RealName"));
                openActivity(EconomicalDriveDetailActivity.class,bundle1);
                break;
            case R.id.drivescore_tv_comment:
                //打开点评界面
                Bundle bundle2=new Bundle();
                bundle2.putString("UserPhone",getIntent().getExtras().getString("UserPhone"));
                bundle2.putString("RealName",getIntent().getExtras().getString("RealName"));
                openActivity(CommentsActivity.class,bundle2);
                break;
        }
    }


//    private  List<IBarDataSet> sets=new ArrayList<IBarDataSet>();
//    private void setBarChartData(List<BarEntry> lists0,List<BarEntry> lists1,List<BarEntry> lists2){
//        BarDataSet set0=new BarDataSet(lists0,"最高评分");
//        set0.setColor(Color.RED);
//        BarDataSet set1=new BarDataSet(lists1,"平均评分");
//        set1.setColor(Color.BLACK);
//        BarDataSet set2=new BarDataSet(lists2,"最低评分");
//        set2.setColor(Color.BLUE);
//        sets.clear();
//        sets.add(set0);
//        sets.add(set1);
//        sets.add(set2);
//
//        BarData data=new BarData(new String[]{"安全","经济"},sets);
//        barChart.setDescription("");
//        barChart.getAxisRight().setDrawLabels(false);
//        barChart.setBarChartData(data);
//        barChart.animateY(3000, Easing.EasingOption.EaseInCubic);
//    }

    private void initBarChart(){
        //设置柱状图参数
        barChart.setDrawBarShadow(false);
        barChart.setDrawValueAboveBar(true);
        barChart.setDescription("");
        barChart.getLegend().setPosition(Legend.LegendPosition.ABOVE_CHART_CENTER);
        barChart.setNoDataTextDescription("暂无数据");
//        barChart.getAxisRight().setDrawLabels(false);
        //设置x轴参数
        XAxis xAxis=barChart.getXAxis();
//        List<String> xvalues=new ArrayList<String>();
//        xvalues.add("安全");
//        xvalues.add("经济");
//        xAxis.setValues(xvalues);
//        xAxis.setDrawGridLines(false);
        xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
        //设置左侧y轴参数
        YAxis yAxis=barChart.getAxisLeft();
//        yAxis.setDrawGridLines(false);
        yAxis.setLabelCount(8,true);
        yAxis.setAxisMinValue(0);
        //设置右侧y轴参数
//        barChart.getAxisRight().setDrawGridLines(false);
//        barChart.getAxisRight().setDrawLabels(false);
    }

    @Override
    public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
        switch (position){
            case 0:
                if(currentLevel==0){
                    return;
                }
                progressDialog.show();
                HashMap<String,String> hashMap=new HashMap<>();
                hashMap.put("UserPhone",user.getUserPhone());
                hashMap.put("YearCode",dateInfos.get(0).yearcode+"");
                hashMap.put("WeekCode",dateInfos.get(0).weekcode+"");
                iHttp.httpInfoPostWithIndex(Config.URL+Config.SCOREREPORT,Config.translateMap(hashMap),callback,0);
                break;
            case 1:
                if(currentLevel==1){
                    return;
                }
                progressDialog.show();
                HashMap<String,String> hashMap1=new HashMap<>();
                hashMap1.put("UserPhone",user.getUserPhone());
                hashMap1.put("YearCode",dateInfos.get(1).yearcode+"");
                hashMap1.put("WeekCode",dateInfos.get(1).weekcode+"");
                iHttp.httpInfoPostWithIndex("http://121.41.108.127:8080/User.php?get=UserScoreReport",Config.translateMap(hashMap1),callback,1);
                break;
            case 2:
                if(currentLevel==2){
                    return;
                }
                progressDialog.show();
                HashMap<String,String> hashMap2=new HashMap<>();
                hashMap2.put("UserPhone",user.getUserPhone());
                hashMap2.put("YearCode",dateInfos.get(1).yearcode+"");
                hashMap2.put("WeekCode",dateInfos.get(1).weekcode+"");
                iHttp.httpInfoPostWithIndex("http://121.41.108.127:8080/User.php?get=UserScoreReport",Config.translateMap(hashMap2),callback,2);
                break;
            case 3:
                if(currentLevel==3){
                    return;
                }
                progressDialog.show();
                HashMap<String,String> hashMap3=new HashMap<>();
                hashMap3.put("UserPhone",user.getUserPhone());
                hashMap3.put("YearCode",dateInfos.get(1).yearcode+"");
                hashMap3.put("WeekCode",dateInfos.get(1).weekcode+"");
                iHttp.httpInfoPostWithIndex("http://121.41.108.127:8080/User.php?get=UserScoreReport",Config.translateMap(hashMap3),callback,3);
                break;
        }
    }

    @Override
    public void onNothingSelected(AdapterView<?> parent) {

    }

    private void getDateInfos(){
        int thisweek=calendar.get(Calendar.WEEK_OF_YEAR);
        int thisyear=calendar.get(Calendar.YEAR);
        DateInfo dateInfo1=new DateInfo(),dateInfo2=new DateInfo(),dateInfo3=new DateInfo(),dateInfo4=new DateInfo();
        if(thisweek==1){
            dateInfo1.weekcode=52;
            dateInfo1.yearcode=thisyear-1;
            dateInfo2.weekcode=51;
            dateInfo2.yearcode=thisyear-1;
            dateInfo3.weekcode=50;
            dateInfo3.yearcode=thisyear-1;
            dateInfo4.weekcode=49;
            dateInfo4.yearcode=thisyear-1;
        }else
        if(thisweek==2){
            dateInfo1.weekcode=1;
            dateInfo1.yearcode=thisyear;
            dateInfo2.weekcode=52;
            dateInfo2.yearcode=thisyear-1;
            dateInfo3.weekcode=51;
            dateInfo3.yearcode=thisyear-1;
            dateInfo4.weekcode=50;
            dateInfo4.yearcode=thisyear-1;
        }else
        if(thisweek==3){
            dateInfo1.weekcode=2;
            dateInfo1.yearcode=thisyear;
            dateInfo2.weekcode=1;
            dateInfo2.yearcode=thisyear;
            dateInfo3.weekcode=52;
            dateInfo3.yearcode=thisyear-1;
            dateInfo4.weekcode=51;
            dateInfo4.yearcode=thisyear-1;
        }else
        if(thisweek==4){
            dateInfo1.weekcode=3;
            dateInfo1.yearcode=thisyear;
            dateInfo2.weekcode=2;
            dateInfo2.yearcode=thisyear;
            dateInfo3.weekcode=1;
            dateInfo3.yearcode=thisyear;
            dateInfo4.weekcode=52;
            dateInfo4.yearcode=thisyear-1;
        }else{
            dateInfo1.weekcode=thisweek-1;
            dateInfo1.yearcode=thisyear;
            dateInfo2.weekcode=thisweek-2;
            dateInfo2.yearcode=thisyear;
            dateInfo3.weekcode=thisweek-3;
            dateInfo3.yearcode=thisyear;
            dateInfo4.weekcode=thisweek-4;
            dateInfo4.yearcode=thisyear;
        }
        dateInfos.add(dateInfo1);
        dateInfos.add(dateInfo2);
        dateInfos.add(dateInfo3);
        dateInfos.add(dateInfo4);
    }

    class DateInfo{
        int yearcode;
        int weekcode;
    }
}
